home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / sd-26.zip / database.h < prev    next >
Text File  |  1992-09-09  |  18KB  |  409 lines

  1. /* SD -- square dance caller's helper.
  2.  
  3.     Copyright (C) 1990, 1991, 1992  William B. Ackerman.
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 1, or (at your option)
  8.     any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     This is for version 25. */
  20.  
  21. /* These are written as the first two halfwords of the binary database file.
  22.    The format version is not related to the version of the program or database.
  23.    It is used only to make sure that the "mkcalls" program that compiled
  24.    the database and the "sd" program that reads it are in sync with each
  25.    other, as indicated by the version of this file.  Whenever we change
  26.    anything in this file that could cause an incompatibility, we bump the
  27.    database format version. */
  28.  
  29. #define DATABASE_MAGIC_NUM 21316
  30. #define DATABASE_FORMAT_VERSION 26
  31.  
  32. /* BEWARE!!  This list must track the tables "flagtab" and "nexttab"" in mkcalls.c .
  33.    Because the constants are not defined contiguously, there are spacer items
  34.    in those tables.
  35.    The last bunch of flags are pushed up against the high end of the word, so that
  36.    they can exactly match some other flags.  The constant HERITABLE_FLAG_MASK
  37.    embraces them.  The flags that must stay in step are in the "FINAL__XXX" group
  38.    in sd.h, the "cflag__xxx" group in database.h, and the "dfm_xxx" group in
  39.    database.h . There is compile-time code in sdinit.c to check that these
  40.    constants are all in step.
  41. */
  42.  
  43. #define cflag__step_to_wave               0x00000001
  44. #define cflag__rear_back_from_r_wave      0x00000002
  45. #define cflag__rear_back_from_qtag        0x00000004
  46. #define cflag__dont_use_in_resolve        0x00000008
  47. #define cflag__requires_selector          0x00000010
  48. #define cflag__requires_number            0x00000020
  49. #define cflag__sequence_starter           0x00000040
  50. #define cflag__split_like_square_thru     0x00000080
  51. #define cflag__split_like_dixie_style     0x00000100
  52. #define cflag__parallel_conc_end          0x00000200
  53. #define cflag__take_right_hands           0x00000400
  54. #define cflag__is_tag_call                0x00000800
  55. #define cflag__is_scoot_call              0x00001000
  56. #define cflag__is_star_call               0x00002000
  57. #define cflag__split_large_setups         0x00004000
  58. #define cflag__fudge_to_q_tag             0x00008000
  59. #define cflag__visible_fractions          0x00010000
  60. #define cflag__first_part_visible         0x00020000
  61. /* space left for                         0x00040000 */
  62. /* space left for                         0x00080000 */
  63. /* space left for                         0x00100000 */
  64. /* space left for                         0x00200000 */
  65. #define cflag__diamond_is_inherited       0x00400000
  66. #define cflag__reverse_means_mirror       0x00800000
  67. #define cflag__left_means_mirror          0x01000000
  68. #define cflag__funny_is_inherited         0x02000000
  69. #define cflag__intlk_is_inherited         0x04000000
  70. #define cflag__magic_is_inherited         0x08000000
  71. #define cflag__grand_is_inherited         0x10000000
  72. #define cflag__twelvematrix_is_inherited  0x20000000
  73. #define cflag__cross_is_inherited         0x40000000
  74. #define cflag__single_is_inherited        0x80000000
  75.  
  76. #define HERITABLE_FLAG_MASK               0xFFC00000
  77.  
  78. /* Beware!!  This list must track the table "matrixcallflagtab" in mkcalls.c . */
  79.  
  80. #define MTX_USE_SELECTOR           0001
  81. #define MTX_STOP_AND_WARN_ON_TBONE 0002
  82. #define MTX_TBONE_IS_OK            0004
  83. #define MTX_IGNORE_NONSELECTEES    0010
  84. #define MTX_MUST_FACE_SAME_WAY     0020
  85.  
  86.  
  87. /* BEWARE!!  This list must track the table "leveltab" in mkcalls.c . */
  88. /* BEWARE!!  This list must track the table "getout_strings" in sdtables.c . */
  89. /* BEWARE!!  This list must track the table "filename_strings" in sdtables.c . */
  90.  
  91. typedef enum {
  92.    l_mainstream, l_plus,
  93.    l_a1, l_a2, l_c1, l_c2,
  94.    l_c3a, l_c3, l_c3x, l_c4a, l_c4,
  95.    l_dontshow, l_nonexistent_concept
  96. } level;
  97.  
  98. /* These are the states that people can be in, and the "ending setups" that can appear
  99.    in the call data base. */
  100. /* BEWARE!!  This list must track the array "estab" in mkcalls.c . */
  101. /* BEWARE!!  This list must track the array "keytab" in sdtables.c . */
  102. /* BEWARE!!  This list must track the array "setup_coords" in sdtables.c . */
  103. /* BEWARE!!  This list must track the array "nice_setup_coords" in sdtables.c . */
  104. /* BEWARE!!  This list must track the array "setup_limits" in sdtables.c . */
  105. /* BEWARE!!  This list must track the array "map_lists" in sdtables.c . */
  106. /* BEWARE!!  This list must track the array "bigconctab" in sdconc.c . */
  107. /* BEWARE!!  The procedure "merge_setups" canonicalizes pairs of setups by their
  108.    order in this list, and will break if it is re-ordered randomly.  See the comments
  109.    there before changing the order of existing setups. In general, keep small setups
  110.    first, particularly 4-person setups before 8-person setups. */
  111.  
  112. typedef enum {
  113.    nothing,
  114.    s_1x1,
  115.    s_1x2,
  116.    s_1x3,
  117.    s2x2,
  118.    sdmd,
  119.    s_star,
  120.    s_trngl,
  121.    s_bone6,
  122.    s_short6,
  123.    s_qtag,
  124.    s_bone,
  125.    s_rigger,
  126.    s_spindle,
  127.    s_hrglass,
  128.    s_hyperglass,
  129.    s_crosswave,
  130.    s1x4,
  131.    s1x8,
  132.    s2x4,
  133.    s_2x3,
  134.    s_1x6,
  135.    s3x4,
  136.    s2x6,
  137.    s2x8,
  138.    s4x4,
  139.    s_c1phan,
  140.    s_bigblob,
  141.    s_ptpd,
  142.    s_3x1dmd,
  143.    s_3dmd,
  144.    s_4dmd,
  145.    s_wingedstar,
  146.    s_wingedstar12,
  147.    s_wingedstar16,
  148.    s_galaxy,
  149.    s4x6,
  150.    s_thar,
  151.    s_normal_concentric
  152. } setup_kind;
  153.  
  154. /* These are the "beginning setups" that can appear in the call data base. */
  155. /* BEWARE!!  This list must track the array "sstab" in mkcalls.c . */
  156. /* BEWARE!!  This list must track the array "begin_sizes" in mkcalls.c . */
  157. /* BEWARE!!  This list must track the array "begin_sizes" in sdtables.c . */
  158.  
  159. typedef enum {
  160.    b_nothing,
  161.    b_1x1,
  162.    b_1x2,
  163.    b_2x1,
  164.    b_1x3,
  165.    b_3x1,
  166.    b_2x2,
  167.    b_dmd,
  168.    b_pmd,
  169.    b_star,
  170.    b_trngl,
  171.    b_ptrngl,
  172.    b_bone6,
  173.    b_pbone6,
  174.    b_short6,
  175.    b_pshort6,
  176.    b_qtag,
  177.    b_pqtag,
  178.    b_bone,
  179.    b_pbone,
  180.    b_rigger,
  181.    b_prigger,
  182.    b_spindle,
  183.    b_pspindle,
  184.    b_hrglass,
  185.    b_phrglass,
  186.    b_crosswave,
  187.    b_pcrosswave,
  188.    b_1x4,
  189.    b_4x1,
  190.    b_1x8,
  191.    b_8x1,
  192.    b_2x4,
  193.    b_4x2,
  194.    b_2x3,
  195.    b_3x2,
  196.    b_1x6,
  197.    b_6x1,
  198.    b_3x4,
  199.    b_4x3,
  200.    b_2x6,
  201.    b_6x2,
  202.    b_2x8,
  203.    b_8x2,
  204.    b_4x4,
  205.    b_c1phan,
  206.    b_pc1phan,
  207.    b_galaxy,
  208.    b_4x6,
  209.    b_6x4,
  210.    b_thar,
  211.    b_ptpd,
  212.    b_pptpd,
  213.    b_3x1dmd,
  214.    b_p3x1dmd,
  215.    b_3dmd,
  216.    b_p3dmd,
  217.    b_4dmd,
  218.    b_p4dmd
  219. } begin_kind;
  220.  
  221. /* These bits are used in the "callarray_flags" field of a "callarray". */
  222.  
  223. /* This one must be 1!!!! */
  224. #define CAF__ROT 0x1
  225. #define CAF__FACING_FUNNY 0x2
  226. /* Next one says this is concentrically defined --- the "end_setup" slot
  227.    has the centers' end setup, and there is an extra slot with the ends' end setup. */
  228. #define CAF__CONCEND 0x4
  229. /* Next one meaningful only if previous one is set. */
  230. #define CAF__ROT_OUT 0x8
  231. #define CAF__RESTR_UNUSUAL 0x10
  232. #define CAF__RESTR_FORBID 0x20
  233. #define CAF__PREDS 0x40
  234.  
  235. /* These qualifiers are "overloaded" -- their meaning depends on the starting setup. */
  236. /* BEWARE!!  This list must track the array "qualtab" in mkcalls.c . */
  237.  
  238. typedef enum {
  239.    sq_none,
  240.    sq_wave_only,                    /* 1x4 or 2x4 - waves */
  241.    sq_2fl_only,                     /* 1x4 or 2x4 - 2FL's */
  242.    sq_miniwaves,                    /* 1x2, 1x4, 1x8, 2x4, 2x2, dmd, qtag, trngl - people
  243.                                        are paired in miniwaves of various handedness.
  244.                                        For diamonds and qtags, this applies just to the centers.
  245.                                        For triangles, it applies just to the base.
  246.                                        So this includes waves, inverted lines, columns,
  247.                                        magic columns, diamonds, wave-based triangles... */
  248.    sq_rwave_only,                   /* As above, but all the miniwaves must be right-handed */
  249.    sq_lwave_only,                   /* As above, but all the miniwaves must be left-handed */
  250.    sq_3_4_tag,                      /* dmd, qtag - this is a 3/4 tag, i.e. points are looking out */
  251.    sq_dmd_same_pt,                  /* dmd - centers would circulate to same point */
  252.    sq_dmd_facing,                   /* dmd - diamond is fully occupied and fully facing */
  253.    sq_true_Z,                       /* 2x3, 3x4, 2x6 - setup is a genuine Z */
  254.    sq_ctrwv_end2fl,                 /* crosswave - center line is wave, end line is 2fl */
  255.    sq_ctr2fl_endwv                  /* crosswave - center line is 2fl, end line is wave */
  256. } search_qualifier;
  257.  
  258. /* These restrictions are "overloaded" -- their meaning depends on the starting setup. */
  259. /* BEWARE!!  This list must track the array "crtab" in mkcalls.c . */
  260.  
  261. typedef enum {
  262.    cr_any,
  263.    cr_alwaysfail,                   /* any setup - this always fails (presumably to give the "unusual position" warning) */
  264.    cr_wave_only,                    /* 1x2 - a miniwave; 1x4 - a wave; 2x4 - waves; 1x8 - a grand wave; 2x2 - real box; qtag - wave in center; 4x2 or 3x2 - column */
  265.    cr_wave_unless_say_2faced,
  266.    cr_1fl_only,                     /* 1x4 - a 1FL; 2x3 or 2x4 - 1FL's */
  267.    cr_2fl_only,                     /* 1x2 - a couple; 1x4 - a 2FL; 2x4 - 2FL's; 1x8 - a grand 2FL; 2x2 - "1-faced" box; qtag - 2FL in center */
  268.    cr_couples_only,                 /* 1x2 or 1x4 or 2x2 or 2x4 lines or columns - people are in genuine couples, not miniwaves */
  269.    cr_awkward_centers,              /* 1x4 or 1x2 - centers must not have left hands with each other */
  270.    cr_magic_only,                   /* 2x2 - split-trade-circulate type of box; 4x2 - magic column */
  271.    cr_peelable_box,                 /* 2x2 - box with each person in genuine tandem; 2x4 - ends are such */
  272.    cr_not_tboned,                   /* 2x2 - people must not be T-boned */
  273.    cr_quarterbox_or_col,            /* 4x2 - acceptable setup for "triple cross" */
  274.    cr_quarterbox_or_magic_col       /* 4x2 - acceptable setup for "make magic" */
  275. } call_restriction;
  276.  
  277. /* BEWARE!!  This list must track the array "schematab" in mkcalls.c . */
  278. typedef enum {
  279.    schema_concentric,
  280.    schema_cross_concentric,
  281.    schema_single_concentric,
  282.    schema_single_cross_concentric,
  283.    schema_maybe_single_concentric,
  284.    schema_concentric_diamond_line,
  285.    schema_concentric_6_2,
  286.    schema_concentric_2_6,
  287.    schema_conc_star,
  288.    schema_conc_star12,
  289.    schema_conc_star16,
  290.    schema_maybe_matrix_conc_star,
  291.    schema_checkpoint,
  292.    schema_rev_checkpoint,
  293.    schema_ckpt_star,
  294.    schema_lateral_6,       /* Not for public use! */
  295.    schema_vertical_6,      /* Not for public use! */
  296.    schema_sequential,
  297.    schema_split_sequential,
  298.    schema_by_array,
  299.    schema_nothing,
  300.    schema_matrix,
  301.    schema_partner_matrix,
  302.    schema_roll
  303. } calldef_schema;
  304.  
  305. /* Maximum number of subcalls in a sequential definition ("schema_sequential") list. */
  306. #define SEQDEF_MAX 8
  307.  
  308. /* BEWARE!!  This list must track the table "defmodtab" in mkcalls.c .
  309.    Because the constants are not defined contiguously, there are spacer items
  310.    in that table. */
  311. /* BEWARE!!  Some of these flags co-exist with other flags defined elsewhere.
  312.    The early ones are "concentricity" flags.  They must co-exist with the
  313.    setupflags defined in sd.h because they share the same word.  For that reason,
  314.    the latter flags are defined at the high end of the word, and the concentricity
  315.    flags shown here are at the low end.
  316.    The last bunch of flags are pushed up against the high end of the word, so that
  317.    they can exactly match some other flags.  The constant HERITABLE_FLAG_MASK
  318.    embraces them.  The flags that must stay in step are in the "FINAL__XXX" group
  319.    in sd.h, the "cflag__xxx" group in database.h, and the "dfm_xxx" group in
  320.    database.h . There is compile-time code in sdinit.c to check that these
  321.    constants are all in step.
  322.  
  323.    dfm_conc_demand_lines             --  concdefine outers: must be ends of lines at start
  324.    dfm_conc_demand_columns           --  concdefine outers: must be ends of columns at start
  325.    dfm_conc_force_lines              --  concdefine outers: force them to line spots when done
  326.    dfm_conc_force_columns            --  concdefine outers: force them to column spots when done
  327.    dfm_conc_force_otherway           --  concdefine outers: force them to other spots when done
  328.    dfm_conc_force_spots              --  concdefine outers: force them to same spots when done
  329.    dfm_conc_concentric_rules         --  concdefine outers: apply actual concentric ("lines-to-lines/columns-to-columns") rule
  330.    dfm_suppress_elongation_warnings  --  concdefine outers: suppress warn_lineconc_perp etc.
  331.            NOTE: the above 8 flags are specified only in the second spec, even if the concept is
  332.               cross-concentric, in which case the "demand" flags might be considered to belong
  333.               with the first spec.
  334.    dfm_or_anycall                    --  concdefine/seqdefine: can substitute something if clicked on "allow mods"
  335.    dfm_mandatory_anycall             --  concdefine/seqdefine: always substitute something
  336.    dfm_repeat_n                      --  seqdefine: take a numeric argument and replicate this part N times
  337.    dfm_repeat_nm1                    --  seqdefine: take a numeric argument and replicate this part N-1 times
  338.    dfm_repeat_n_alternate            --  seqdefine: take a numeric argument and replicate this part and the next one N times alternately
  339.    dfm_endscando                     --  concdefine outers: can tell ends only to do this
  340.    dfm_allow_forced_mod              --  concdefine/seqdefine: can forcibly substitute something if clicked on "allow forcible mods"
  341.    dfm_roll_transparent              --  seqdefine: any person who is marked roll-neutral after this call has his previous roll status restored
  342.    dfm_must_be_tag_call              --  seqdefine: the subject call (or any replacement for it) must be a tagging call
  343.    dfm_must_be_scoot_call            --  seqdefine: the subject call (or any replacement for it) must be a scoot-back-type call
  344.    dfm_cpls_unless_single            --  seqdefine: the do this part as couples, unless this call is being done "single"
  345.                                                                and "single_is_inherited" was set
  346.    dfm_inherit_diamond               --  concdefine/seqdefine: if original call said "diamond" apply it to this part
  347.    dfm_inherit_left                  --  concdefine/seqdefine: if original call said "left" apply it to this part
  348.    dfm_inherit_funny                 --  concdefine/seqdefine: if original call said "funny" apply it to this part
  349.    dfm_inherit_intlk                 --  concdefine/seqdefine: if original call said "interlocked" apply it to this part
  350.    dfm_inherit_magic                 --  concdefine/seqdefine: if original call said "magic" apply it to this part
  351.    dfm_inherit_grand                 --  concdefine/seqdefine: if original call said "grand" apply it to this part
  352.    dfm_inherit_12_matrix             --  concdefine/seqdefine: if original call said "12matrix" apply it to this part
  353.    dfm_inherit_cross                 --  concdefine/seqdefine: if original call said "cross" apply it to this part
  354.    dfm_inherit_single                --  concdefine/seqdefine: if original call said "single" apply it to this part
  355. */
  356.  
  357.  
  358. /* Start of concentricity flags. */
  359.  
  360. #define dfm_conc_demand_lines             0x00000001
  361. #define dfm_conc_demand_columns           0x00000002
  362. #define dfm_conc_force_lines              0x00000004
  363. #define dfm_conc_force_columns            0x00000008
  364. #define dfm_conc_force_otherway           0x00000010
  365. #define dfm_conc_force_spots              0x00000020
  366. #define dfm_conc_concentric_rules         0x00000040
  367. #define dfm_suppress_elongation_warnings  0x00000080
  368.  
  369. /* End of concentricity flags.  This constant embraces them. */
  370. #define DFM_CONCENTRICITY_FLAG_MASK       0x000000FF
  371.  
  372. /* Start of miscellaneous flags. */
  373.  
  374. #define dfm_or_anycall                    0x00000100
  375. #define dfm_mandatory_anycall             0x00000200
  376. #define dfm_repeat_n                      0x00000400
  377. #define dfm_repeat_nm1                    0x00000800
  378. #define dfm_repeat_n_alternate            0x00001000
  379. #define dfm_endscando                     0x00002000
  380. #define dfm_allow_forced_mod              0x00004000
  381. #define dfm_roll_transparent              0x00008000
  382. #define dfm_must_be_tag_call              0x00010000
  383. #define dfm_must_be_scoot_call            0x00020000
  384. #define dfm_cpls_unless_single            0x00040000
  385.  
  386. /* End of miscellaneous flags. */
  387.  
  388. /* space left for                         0x00080000 */
  389. /* space left for                         0x00100000 */
  390. /* space left for                         0x00200000 */
  391.  
  392. /* Start of inheritance flags. */
  393.  
  394. #define dfm_inherit_diamond               0x00400000
  395. #define dfm_inherit_reverse               0x00800000
  396. #define dfm_inherit_left                  0x01000000
  397. #define dfm_inherit_funny                 0x02000000
  398. #define dfm_inherit_intlk                 0x04000000
  399. #define dfm_inherit_magic                 0x08000000
  400. #define dfm_inherit_grand                 0x10000000
  401. #define dfm_inherit_12_matrix             0x20000000
  402. #define dfm_inherit_cross                 0x40000000
  403. #define dfm_inherit_single                0x80000000
  404.  
  405. /* The first 6 predicates (in "pred_table" in preds.c and "predtab" in mkcalls.c)
  406.    take selectors.  The following constant indicates that. */
  407. #define SELECTOR_PREDS 6
  408.  
  409.